package com.pcbly.web.components.utils.template.dao;
 
import com.pcbly.web.bean.user.*;
import com.pcbly.web.components.utils.template.AbstractModel;
import com.pcbly.web.components.utils.template.ModelPrint;

public class ModelCommonDao extends ModelPrint {
	
	public void execute(Class<?> clz) {
		if(print){
			daoXml(clz);
		}else{
			daoXml(clz);
			dao(clz);
		}

	}
	private void daoXml(Class<?> clz){
		AbstractModel model = new ModelDaoXml(clz);
		model.setTableName(tableName);
		model.setPrint(print);
		model.execute();
	}
	private void dao(Class<?> clz){
		AbstractModel model = new ModelDao(clz);
		model.setTableName(tableName);
		model.execute();
		
		model = new ModelDaoImp(clz);
		model.setTableName(tableName);
		model.execute();
	}

	private String tableName; 

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public static void main(String[] args) {
		ModelCommonDao model = new ModelCommonDao();
		model.setTableName("sys_user_workexperience");
		model.setPrint(false);
		model.execute(UserWorkExperienceBean.class);
	}
}
